{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {
    "dotnet_interactive": {
     "language": "pwsh"
    },
    "polyglot_notebook": {
     "kernelName": "pwsh"
    }
   },
   "source": [
    "- Checks for and installs the `PowerShellAI` module\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "dotnet_interactive": {
     "language": "pwsh"
    },
    "polyglot_notebook": {
     "kernelName": "pwsh"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Already installed\r\n"
     ]
    }
   ],
   "source": [
    "if(!(Get-Module -list PowerShellAI)) {\n",
    "    Install-Module -Name PowerShellAI \n",
    "} else {\n",
    "    \"Already installed\"\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "dotnet_interactive": {
     "language": "pwsh"
    },
    "polyglot_notebook": {
     "kernelName": "pwsh"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "1..10 | Where-Object {$_ % 2 -eq 0}\r\n"
     ]
    }
   ],
   "source": [
    "gpt 'use powershell to show all the even numbers between 1 and 10'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "dotnet_interactive": {
     "language": "pwsh"
    },
    "polyglot_notebook": {
     "kernelName": "pwsh"
    },
    "vscode": {
     "languageId": "polyglot-notebook"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
      "<root>\n",
      "  <planets>Mercury</planets>\n",
      "  <planets>Venus</planets>\n",
      "  <planets>Earth</planets>\n",
      "  <planets>Mars</planets>\n",
      "  <planets>Jupiter</planets>\n",
      "  <planets>Saturn</planets>\n",
      "  <planets>Uranus</planets>\n",
      "  <planets>Neptune</planets>\n",
      "</root>\r\n"
     ]
    }
   ],
   "source": [
    "ai 'list planets only names as a json object' | ai 'convert to xml'"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (PowerShell)",
   "language": "PowerShell",
   "name": ".net-pwsh"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "pwsh",
    "items": [
     {
      "aliases": [
       "powershell"
      ],
      "languageName": "PowerShell",
      "name": "pwsh"
     },
     {
      "aliases": [
       "frontend"
      ],
      "name": "vscode"
     },
     {
      "aliases": [],
      "name": "value"
     },
     {
      "aliases": [],
      "name": ".NET"
     },
     {
      "aliases": [
       "c#",
       "C#"
      ],
      "languageName": "C#",
      "name": "csharp"
     },
     {
      "aliases": [
       "f#",
       "F#"
      ],
      "languageName": "F#",
      "name": "fsharp"
     },
     {
      "aliases": [],
      "languageName": "HTML",
      "name": "html"
     },
     {
      "aliases": [],
      "languageName": "KQL",
      "name": "kql"
     },
     {
      "aliases": [],
      "languageName": "Mermaid",
      "name": "mermaid"
     },
     {
      "aliases": [],
      "languageName": "SQL",
      "name": "sql"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
